#pragma once
#include <iostream>

class Date
{
	friend std::ostream& operator<<(std::ostream& out, const Date& d);
	friend std::istream& operator>>(std::istream& in, Date& d);
public:
	Date(int year = 1900, int month = 1, int day = 1);
	~Date();

	bool IsLeapYear(int year);
	int GetMonthDays(int year, int month);


	bool operator!=(const Date& d) const;
	bool operator==(const Date& d) const;
	bool operator>(const Date& d) const;
	bool operator>=(const Date& d) const;
	bool operator<(const Date& d) const;
	bool operator<=(const Date& d) const;

	Date& operator++();
	Date operator++(int);

	Date& operator--();
	Date operator--(int);
	
	Date& operator+=(int days);
	Date operator+(int days);

	Date& operator-=(int days);
	Date operator-(int days);
	int operator-(const Date& d);

	void swap(Date& d)
	{
		std::swap(_year, d._year);
		std::swap(_month, d._month);
		std::swap(_day, d._day);
	}
private:
	int _year;
	int _month;
	int _day;
};

